package chapter5;

public class VariableOverrideTest {

    private String name = "wussrc";
    private static double price = 78.0;

    public static void main(String[] args) {
        int price = 65;//局部变量和成员变量同名
        //直接访问price，方法内的局部变量会覆盖成员变量
        System.out.println(price);
        //访问静态的成员变量
        System.out.println(VariableOverrideTest.price);
        new VariableOverrideTest().info();
    }

    public void info() {
        //局部变量，覆盖成员变量
        String name = "leemz";
        System.out.println(name);
        //访问成员变量
        System.out.println(this.name);
    }
}
